@file:Suppress("NOTHING_TO_INLINE")

package com.hzw.core.resources

import android.content.Context
import android.view.View
import androidx.annotation.ArrayRes
import androidx.annotation.AttrRes
import androidx.annotation.BoolRes
import androidx.annotation.IntegerRes
import androidx.fragment.app.Fragment
import com.hzw.core.ctx.appCtx

inline fun Context.bool(@BoolRes boolResId: Int): Boolean = resources.getBoolean(boolResId)
inline fun Fragment.bool(@BoolRes boolResId: Int) = context!!.bool(boolResId)
inline fun View.bool(@BoolRes boolResId: Int) = context.bool(boolResId)
inline fun appBool(@BoolRes boolResId: Int) = appCtx.bool(boolResId)

fun Context.styledBool(@AttrRes attr: Int): Boolean = withStyledAttributes(attr) { getBoolean(it, false) }
inline fun Fragment.styledBool(@AttrRes attr: Int) = context!!.styledBool(attr)
inline fun View.styledBool(@AttrRes attr: Int) = context.styledBool(attr)
inline fun appStyledBool(@AttrRes attr: Int) = appCtx.styledBool(attr)
